import { request } from "@utils/http"
import {hosScheduleWorkDateRetrunType, hosScheduleWorkDateParamsType,hosScheduleRuleReturnType, hosScheduleRuleParamsType, hosScheduleDepartmentType, hosListParamsType, hospitalListReturnType, getProvinceReturnType, getHosListDetailReturnType } from "@api/hospital/model/hospitalListType"
//初始化分页加载医院列表
export const initHospitalListRequest = ({ page, limit }: { page: number, limit: number }, searchParams: hosListParamsType) => {
    return request.get<any, hospitalListReturnType>(`/admin/hosp/hospital/${page}/${limit}`, {
        params: { ...searchParams }
    })
}


//初始获取省份信息
export const getProvinceRequest = () => {
    return request.get<any, getProvinceReturnType>("/admin/cmn/dict/findByDictCode/province")
}
//获取市或区的信息
export const getCityOrDistrictRequest = (value: string) => {
    return request.get<any, getProvinceReturnType>(`/admin/cmn/dict/findByParentId/${value}`)
}
//获取医院详情的信息
export const getHosListDetailRequest = (id: string) => {
    return request.get<any, getHosListDetailReturnType>(`/admin/hosp/hospital/show/${id}`)
}
//医院上下线状态请求
export const hospitalListStatusRuquest = (id: string, status: number) => {
    return request.get<any, null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}
//医院排版信息请求
export const hosScheduleRequest = (hoscode: string) => {
    return request.get<any, hosScheduleDepartmentType>(`/admin/hosp/department/${hoscode}`)
}

//医院排版规则请求
export const hosScheduleRuleRequest = ({ page, limit, hoscode, depcode }: hosScheduleRuleParamsType) => {
    return request.get<any, hosScheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}
//医院医生详情数据请求
export const hosScheduleWorkDateRequest = ({hoscode,depcode,workDate}:hosScheduleWorkDateParamsType) => {
    return request.get<any,hosScheduleWorkDateRetrunType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}